package com.nf.health.app.intervention_details.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.nf.health.app.intervention_details.fragment.CatalogueDetailsFragment;
import com.nf.health.app.intervention_details.fragment.DetectiondetailsFragment;
import com.nf.health.app.intervention_details.fragment.DoctorOrderDetailsFragment;
import com.nf.health.app.intervention_details.fragment.ExercisedetailsFragment;
import com.nf.health.app.intervention_details.fragment.FollowupFragment;
import com.nf.health.app.intervention_details.fragment.FoodDetailsFragment;
import com.nf.health.app.intervention_details.fragment.HealthImproveDetailsFragment;
import com.nf.health.app.intervention_details.fragment.InterventionCoverFragment;
import com.nf.health.app.intervention_details.fragment.MeridiandetailsFragment;
import com.nf.health.app.intervention_details.fragment.MusicdetailsFragment;
import com.nf.health.app.intervention_details.fragment.UserHealthInfoFragment;

/**
 * Created by hepann on 2016/11/10.
 * The only genius that is worth anything is the genius for hard work
 *
 * @author hepann
 * @Description
 * @email he_pann@163.com
 */

public class InterventionDetailAdapter extends FragmentPagerAdapter {
    private Fragment[] fragments ;
    private int FRAGMENT_NUM = 11;
    public InterventionDetailAdapter(FragmentManager fm) {
        super(fm);
        initFragment();
    }

    private void initFragment() {
        fragments = new Fragment[FRAGMENT_NUM];
        if(fragments[0] == null){
            fragments[0] = new InterventionCoverFragment();//封面
        }
        if(fragments[1] == null){
            fragments[1] = new CatalogueDetailsFragment();//目录
        }
        if(fragments[2] == null){
            fragments[2] = new UserHealthInfoFragment();//信息汇总
        }
        if(fragments[3] == null){
            fragments[3] = new HealthImproveDetailsFragment();//健康行动改善指南
        }
        if(fragments[4] == null){
            fragments[4] = new FoodDetailsFragment();//膳食方案
        }
        if(fragments[5] == null){
            fragments[5] = new ExercisedetailsFragment();//运动方案详情
        }
        if(fragments[6] == null){
            fragments[6] = new MeridiandetailsFragment();//经络
        }
        if(fragments[7] == null){
            fragments[7] = new MusicdetailsFragment();//音乐
        }
        if(fragments[8] == null){
            fragments[8] = new DetectiondetailsFragment();//计划详情
        }
        if(fragments[9] == null){
            fragments[9] = new DoctorOrderDetailsFragment();//医嘱
        }
        if(fragments[10] == null){
            fragments[10] = new FollowupFragment();//问卷
        }

//        fragments[8] = new PrescriptiondetailsFragment();//调理



    }

    @Override
    public Fragment getItem(int position) {
        return fragments[position];
    }

    @Override
    public int getCount() {
        return FRAGMENT_NUM;
    }
}
